package com.woniuxy.entity;

public class ResponseEntity<T> {
    //自定义状态码，200表示成功，500表示后台报错！
    private int code;
    private String message;
    //封装的DTO对象
    private T data;

    public ResponseEntity() {
    }

    public ResponseEntity(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResponseEntity(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public static final ResponseEntity<Void> SUCCESS = new ResponseEntity(200,"成功");
    public static final ResponseEntity<Void> ERROR = new ResponseEntity(500,"失败");
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
